Ext.define('Zm.controller.Data', {
    extend: 'Ext.app.Controller',
    uses:['Zm.Common','Zm.i18n.Lang'],
    stores:['History'],
    refs:[
        {ref:'X3dView', selector:'x3dview'},
        {ref:'X3dContainer',selector:'x3dcontainer'},
        {ref:'CardView', selector:'cardview'},
        {ref:'TotalView',selector:'totalview'}
    ],
    init: function(){
        var me = this;
        me.control({
            'historylist button[action=search]':{
                click:me.searchData
            }
        });
        me.application.on({
            pagechange:me.showPage,
            scope:me
        });
    },
    searchData:function(btn){
        var me = this,
            loglist = btn.up('historylist'),
            startdate = loglist.down('#startdate').getValue(),
            enddate = loglist.down('#enddate').getValue(),
            tid = loglist.down('#tid').getValue(),
            proxy = loglist.store.getProxy();
        proxy.extraParams = {startdate:startdate,enddate:enddate,tid:tid};
        loglist.store.loadPage(1);
	},
    showPage:function(id){
        var me = this,view;
        if(id == 'totalview'){
            me.getTotalView().taskRef.start();
        }else{
            me.getTotalView().taskRef.stop();
        }
    }
});